package com.villaday.idf.adapter;

import android.content.Context;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;

import com.villaday.idf.R;
import com.villaday.idf.base.AbsRecyclerViewAdapter;
import com.villaday.idf.base.OnAdapterCallbackListener;
import com.villaday.idf.model.HousesStates;

import java.util.ArrayList;
import java.util.List;


public class DateCalendarAdapter extends AbsRecyclerViewAdapter<HousesStates.BodyEntity.MonthsEntity> {
    private OnAdapterCallbackListener onAdapterCallbackListener;
    private View.OnClickListener onClickListener;
/*
    private final String roleType;
*/

    public DateCalendarAdapter(Context context) {
        super(context, R.layout.item_recycler_wrap, R.layout.item_page_loading,
                R.layout.item_page_bottom);

       /* RefreshtokenEntity.BodyBean roleInfo =
                SharedPreferencesUtil.getRoleInfo(context);
        roleType = roleInfo.getMember().getType();*/

    }


    @Override
    public void onBindHolder(AbsRecyclerViewAdapter.RecyclerViewHolder holder, HousesStates.BodyEntity.MonthsEntity d, int position) {

        List<HousesStates.BodyEntity.MonthsEntity.ListEntity> data=new ArrayList<>();
        RecyclerView recyclerView = (RecyclerView) holder.getView(R.id.rv_wrap);
        recyclerView.setLayoutManager(new GridLayoutManager(context, 7));
        DateCalendarInnerAdapter recyclerViewAdapter = new DateCalendarInnerAdapter(context);
        recyclerView.setAdapter(recyclerViewAdapter);
        if ( d.getList().get(0).getDayOfWeek()!=1){
            for (int i = 0; i < d.getList().get(0).getDayOfWeek()-1; i++) {
                data.add(new HousesStates.BodyEntity.MonthsEntity.ListEntity(1));
            }
        }


        data.addAll(d.getList());
        recyclerViewAdapter.setData(data);
    }

}
